package com.lds.config.center.remote.client.server.impl;


import com.lds.config.center.common.model.app.request.AppBaseListRequest;
import com.lds.config.center.common.model.app.response.AppBaseListResponse;
import com.lds.config.center.remote.client.properties.ConfigCenterRemoteClientProperties;
import com.lds.config.center.remote.client.server.AppRemoteClient;
import com.lds.management.center.common.model.dto.ResultDTO;
import com.lds.management.center.common.util.RestUtil;
import org.springframework.core.ParameterizedTypeReference;

public class AppRemoteClientImpl implements AppRemoteClient {
    private final ConfigCenterRemoteClientProperties properties;
    
    public AppRemoteClientImpl(ConfigCenterRemoteClientProperties properties) {
        this.properties = properties;
    }
    
    @Override
    public ResultDTO<AppBaseListResponse> listApp(AppBaseListRequest request) {
        String url = properties.getAddress() + "/api/common/app/list";
        return RestUtil.post(url, request, new ParameterizedTypeReference<ResultDTO<AppBaseListResponse>>() {});
    }
}
